package com.hamster.crmpre.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hamster.crmpre.config.LoginInterceptor;
import com.hamster.crmpre.mapper.BigCompanyRecordMapper;
import com.hamster.crmpre.mapper.CustomerMapper;
import com.hamster.crmpre.mapper.CustomerVipRecordMapper;
import com.hamster.crmpre.mapper.SmallCompanyRecordMapper;
import com.hamster.crmpre.pojo.Customer;
import com.hamster.crmpre.pojo.SmallCompanyRecord;
import com.hamster.crmpre.service.InvitationRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Tarry
 * @create 2020/1/10 11:50
 */
@Service
public class InvitationRecordServiceImpl implements InvitationRecordService {
    @Autowired
    private SmallCompanyRecordMapper smallCompanyRecordMapper;
    @Autowired
    private BigCompanyRecordMapper bigCompanyRecordMapper;
    @Autowired
    private CustomerVipRecordMapper customerVipRecordMapper;
    @Autowired
    private CustomerMapper customerMapper;



    /**
     * vip  或 合伙人的列表
     * @return
     */
    @Override
    public List<Customer> customerListByVip() {
        String userId = LoginInterceptor.getLoginUser().getUserId();
        List<Customer> list = customerVipRecordMapper.customerListByVip(userId);
        return list;
    }

    /**
     * 分公司开发客户的列表
     * @return
     */
    @Override
    public List<Customer> customerListByCompany() {
        String userId = LoginInterceptor.getLoginUser().getUserId();
        QueryWrapper<Customer> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("branch_company_id",userId);
        List<Customer> list = customerMapper.selectList(queryWrapper);
        return list;
    }
}
